/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package forense.frames;

import forense.classes.ArchivoLogger;
import forense.dbo.ConexionBD;
import forense.entities.Case;
import forense.entities.Evidence;
import forense.entities.Team;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;

/**
 *
 * @author Kate
 */
public class CrearCaso extends javax.swing.JFrame {

    String codEvidencia;

    private final static ArchivoLogger log = new ArchivoLogger(CrearCaso.class);

    /**
     * Creates new form Caso
     */
    public CrearCaso() {
        initComponents();
        this.setResizable(false);
        this.setLocationRelativeTo(null);

//        txtDescripcion.setLineWrap(true);
//        txtDescripcion.setWrapStyleWord(true);
//        txtObjetivos.setLineWrap(true);
//        txtObjetivos.setWrapStyleWord(true);
//        txtAlcance.setLineWrap(true);
//        txtAlcance.setWrapStyleWord(true);
//        txtObservaciones.setLineWrap(true);
//        txtObservaciones.setWrapStyleWord(true);
        jTablePersonal.doLayout();
        DefaultTableModel modelo = (DefaultTableModel) jTablePersonal.getModel();
        TableRowSorter sorter = new TableRowSorter(modelo);
        jTablePersonal.setRowSorter(sorter);



        SoloNumeros(txtCedula);
        primeraLetraMayuscula(txtNombres);
        primeraLetraMayuscula(txtApellidos);
        primeraLetraMayuscula(txtSolicitante);
        primeraLetraMayuscula(txtLugarIncautacion);
        //todoMayus(txtCodigoCaso);

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDialog1 = new javax.swing.JDialog();
        jLabel23 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel28 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jLabel29 = new javax.swing.JLabel();
        jScrollPane9 = new javax.swing.JScrollPane();
        jTextArea3 = new javax.swing.JTextArea();
        jPanel5 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jPanelCreateCaso = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtCodigoCaso = new javax.swing.JTextField();
        txtSolicitante = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtDescripcion = new javax.swing.JTextArea();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtObjetivos = new javax.swing.JTextArea();
        jLabel15 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtAlcance = new javax.swing.JTextArea();
        jDateChooserFechaSolicitud = new com.toedter.calendar.JDateChooser();
        btnAtras2 = new javax.swing.JButton();
        btnSiguienteAEquipo = new javax.swing.JButton();
        btnCancelarCrearCaso = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jPanelEquipo = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        txtNombres = new javax.swing.JTextField();
        btnAñadirPersona = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        txtCedula = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        cmbRol = new javax.swing.JComboBox();
        jLabelDescripcionRol = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTablePersonal = new javax.swing.JTable();
        jLabel24 = new javax.swing.JLabel();
        txtApellidos = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        btnEliminar = new javax.swing.JButton();
        btnModificar = new javax.swing.JButton();
        btnAtras1 = new javax.swing.JButton();
        btnSiguienteAEvidencia = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jPanelEvidencia = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        btnAtras3 = new javax.swing.JButton();
        btnSiguiente3 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        btnFinalizar = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtLugarIncautacion = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        btnAñadirDispositivos = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        txtObservaciones = new javax.swing.JTextArea();
        txtFechaIncautacion = new com.toedter.calendar.JDateChooser();
        jLabel27 = new javax.swing.JLabel();
        cmbHora = new javax.swing.JComboBox();
        cmbMinutos = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        txtCodigoEvidencia = new javax.swing.JTextField();

        jDialog1.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        jDialog1.setTitle("Descripción roles");

        jLabel23.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel23.setText("Investigadores/Peritos:");

        jTextArea1.setEditable(false);
        jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
        jTextArea1.setColumns(20);
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setText("Plantea y diseña estrategias concretas basadas en la guía metodológica, es el responsable de identificar y recolectar la evidencia. Además se asegura de que las actividades y/o procesos diseñados en la guía metodológica sean llevados a cabo correctamente.");
        jTextArea1.setWrapStyleWord(true);
        jScrollPane5.setViewportView(jTextArea1);

        jLabel28.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel28.setText("Custodios:");

        jTextArea2.setEditable(false);
        jTextArea2.setBackground(new java.awt.Color(240, 240, 240));
        jTextArea2.setColumns(20);
        jTextArea2.setLineWrap(true);
        jTextArea2.setRows(5);
        jTextArea2.setText("Personal especializado en adquirir, recuperar y analizar los datos digitales.");
        jTextArea2.setWrapStyleWord(true);
        jTextArea2.setMaximumSize(new java.awt.Dimension(102, 48));
        jTextArea2.setMinimumSize(new java.awt.Dimension(104, 48));
        jTextArea2.setPreferredSize(new java.awt.Dimension(102, 48));
        jScrollPane8.setViewportView(jTextArea2);

        jLabel29.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel29.setText("Examinadores/Analistas:");

        jTextArea3.setEditable(false);
        jTextArea3.setBackground(new java.awt.Color(240, 240, 240));
        jTextArea3.setColumns(20);
        jTextArea3.setLineWrap(true);
        jTextArea3.setRows(5);
        jTextArea3.setText("Encargados de proteger la evidencia, se aseguran que la evidencia este etiquetada y sellada adecuadamente, como también se encarga de transportar la evidencia hacia el laboratorio.");
        jTextArea3.setWrapStyleWord(true);
        jScrollPane9.setViewportView(jTextArea3);

        javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
        jDialog1.getContentPane().setLayout(jDialog1Layout);
        jDialog1Layout.setHorizontalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialog1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane5)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
                    .addGroup(jDialog1Layout.createSequentialGroup()
                        .addGroup(jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel23)
                            .addComponent(jLabel28)
                            .addComponent(jLabel29))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE))
                .addContainerGap())
        );
        jDialog1Layout.setVerticalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialog1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel23)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(16, 16, 16)
                .addComponent(jLabel28)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(16, 16, 16)
                .addComponent(jLabel29)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jPanel1.setLayout(new java.awt.CardLayout());

        jPanel11.setBackground(new java.awt.Color(255, 255, 255));
        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Pasos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel11.setMinimumSize(new java.awt.Dimension(170, 441));
        jPanel11.setPreferredSize(new java.awt.Dimension(170, 441));

        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel16.setText("1. Crear caso");

        jLabel17.setText("2. Equipo de investigación");

        jLabel18.setText("3. Evidencia");

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(jLabel17)
                    .addComponent(jLabel18))
                .addGap(0, 33, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel16)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel18)
                .addContainerGap(353, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Caso de estudio", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel6.setMinimumSize(new java.awt.Dimension(575, 441));
        jPanel6.setPreferredSize(new java.awt.Dimension(575, 441));

        jLabel1.setText("Código caso de estudio:");

        jLabel2.setText("Fecha de solicitud examen:");

        jLabel3.setText("Persona/Institución solicitante:");

        txtCodigoCaso.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCodigoCasoKeyTyped(evt);
            }
        });

        jLabel13.setText("Descripción:");

        txtDescripcion.setColumns(20);
        txtDescripcion.setLineWrap(true);
        txtDescripcion.setRows(5);
        txtDescripcion.setWrapStyleWord(true);
        txtDescripcion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtDescripcionKeyTyped(evt);
            }
        });
        jScrollPane1.setViewportView(txtDescripcion);

        jLabel14.setText("Objetivos:");

        txtObjetivos.setColumns(20);
        txtObjetivos.setLineWrap(true);
        txtObjetivos.setRows(5);
        txtObjetivos.setWrapStyleWord(true);
        txtObjetivos.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtObjetivosKeyTyped(evt);
            }
        });
        jScrollPane2.setViewportView(txtObjetivos);

        jLabel15.setText("Alcance:");

        txtAlcance.setColumns(20);
        txtAlcance.setLineWrap(true);
        txtAlcance.setRows(5);
        txtAlcance.setWrapStyleWord(true);
        txtAlcance.setPreferredSize(new java.awt.Dimension(164, 91));
        txtAlcance.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtAlcanceKeyTyped(evt);
            }
        });
        jScrollPane3.setViewportView(txtAlcance);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(jLabel15)
                            .addComponent(jLabel13))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1)))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel2))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCodigoCaso, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtSolicitante, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jDateChooserFechaSolicitud, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(54, 54, 54))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtCodigoCaso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel2)
                    .addComponent(jDateChooserFechaSolicitud, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSolicitante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addGap(88, 88, 88)
                        .addComponent(jLabel15)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(47, 47, 47))))
        );

        btnAtras2.setText("Atrás");
        btnAtras2.setEnabled(false);
        btnAtras2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtras2ActionPerformed(evt);
            }
        });

        btnSiguienteAEquipo.setText("Siguiente");
        btnSiguienteAEquipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSiguienteAEquipoActionPerformed(evt);
            }
        });

        btnCancelarCrearCaso.setText("Cancelar");
        btnCancelarCrearCaso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarCrearCasoActionPerformed(evt);
            }
        });

        jButton3.setText("Finalizar");
        jButton3.setEnabled(false);

        javax.swing.GroupLayout jPanelCreateCasoLayout = new javax.swing.GroupLayout(jPanelCreateCaso);
        jPanelCreateCaso.setLayout(jPanelCreateCasoLayout);
        jPanelCreateCasoLayout.setHorizontalGroup(
            jPanelCreateCasoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCreateCasoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelCreateCasoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCreateCasoLayout.createSequentialGroup()
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCreateCasoLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnAtras2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSiguienteAEquipo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCancelarCrearCaso)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3)))
                .addContainerGap())
        );
        jPanelCreateCasoLayout.setVerticalGroup(
            jPanelCreateCasoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCreateCasoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelCreateCasoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCreateCasoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAtras2)
                    .addComponent(btnSiguienteAEquipo)
                    .addComponent(btnCancelarCrearCaso)
                    .addComponent(jButton3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.add(jPanelCreateCaso, "card2");

        jPanel10.setBackground(new java.awt.Color(255, 255, 255));
        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Pasos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel10.setMinimumSize(new java.awt.Dimension(170, 441));
        jPanel10.setPreferredSize(new java.awt.Dimension(170, 441));

        jLabel8.setText("1. Crear caso");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel11.setText("2. Equipo de investigación");

        jLabel12.setText("3. Evidencia");

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12))
                .addGap(0, 13, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel12)
                .addContainerGap(353, Short.MAX_VALUE))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Equipo de investigación", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel7.setMinimumSize(new java.awt.Dimension(575, 441));
        jPanel7.setPreferredSize(new java.awt.Dimension(575, 441));

        jLabel20.setText("Nombres:");

        btnAñadirPersona.setText("Agregar");
        btnAñadirPersona.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAñadirPersonaActionPerformed(evt);
            }
        });

        jLabel21.setText("Identificación:");

        jLabel22.setText("Rol:");

        cmbRol.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "Investigador/Perito", "Custodio", "Examinador/Analista" }));

        jLabelDescripcionRol.setIcon(new javax.swing.ImageIcon(getClass().getResource("/forense/images/Warning.png"))); // NOI18N
        jLabelDescripcionRol.setToolTipText("Haga clic para obtener una descripción breve del rol");
        jLabelDescripcionRol.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelDescripcionRolMouseClicked(evt);
            }
        });

        jTablePersonal.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Identificación", "Rol", "Nombres", "Apellidos"
            }
        ));
        jTablePersonal.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTablePersonalMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(jTablePersonal);
        if (jTablePersonal.getColumnModel().getColumnCount() > 0) {
            jTablePersonal.getColumnModel().getColumn(0).setMinWidth(80);
            jTablePersonal.getColumnModel().getColumn(0).setPreferredWidth(80);
            jTablePersonal.getColumnModel().getColumn(0).setMaxWidth(80);
            jTablePersonal.getColumnModel().getColumn(1).setMinWidth(100);
            jTablePersonal.getColumnModel().getColumn(1).setPreferredWidth(100);
            jTablePersonal.getColumnModel().getColumn(1).setMaxWidth(100);
            jTablePersonal.getColumnModel().getColumn(2).setMinWidth(150);
            jTablePersonal.getColumnModel().getColumn(2).setPreferredWidth(150);
            jTablePersonal.getColumnModel().getColumn(2).setMaxWidth(150);
            jTablePersonal.getColumnModel().getColumn(3).setMinWidth(150);
            jTablePersonal.getColumnModel().getColumn(3).setPreferredWidth(150);
            jTablePersonal.getColumnModel().getColumn(3).setMaxWidth(150);
        }

        jLabel24.setText("Apellidos:");

        jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/forense/images/20228 (1).png"))); // NOI18N

        btnEliminar.setText("Eliminar");
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });

        btnModificar.setText("Modificar");
        btnModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
                        .addContainerGap(11, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel20)
                            .addComponent(jLabel21)
                            .addComponent(jLabel22)
                            .addComponent(jLabel24))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cmbRol, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addComponent(jLabelDescripcionRol))
                            .addComponent(txtCedula, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22)
                        .addComponent(jLabel19)
                        .addGap(59, 59, 59))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 479, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(btnAñadirPersona)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnModificar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnEliminar)))))
                .addContainerGap(51, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel20)
                            .addComponent(txtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(3, 3, 3)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel24)
                            .addComponent(txtApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel21)
                            .addComponent(txtCedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel22)
                                .addComponent(cmbRol, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabelDescripcionRol)))
                    .addComponent(jLabel19))
                .addGap(25, 25, 25)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAñadirPersona)
                    .addComponent(btnEliminar)
                    .addComponent(btnModificar))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(87, Short.MAX_VALUE))
        );

        btnAtras1.setText("Atrás");
        btnAtras1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtras1ActionPerformed(evt);
            }
        });

        btnSiguienteAEvidencia.setText("Siguiente");
        btnSiguienteAEvidencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSiguienteAEvidenciaActionPerformed(evt);
            }
        });

        jButton4.setText("Cancelar");
        jButton4.setEnabled(false);

        jButton5.setText("Finalizar");
        jButton5.setEnabled(false);

        javax.swing.GroupLayout jPanelEquipoLayout = new javax.swing.GroupLayout(jPanelEquipo);
        jPanelEquipo.setLayout(jPanelEquipoLayout);
        jPanelEquipoLayout.setHorizontalGroup(
            jPanelEquipoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelEquipoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelEquipoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelEquipoLayout.createSequentialGroup()
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelEquipoLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnAtras1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSiguienteAEvidencia)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton5)))
                .addContainerGap())
        );
        jPanelEquipoLayout.setVerticalGroup(
            jPanelEquipoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelEquipoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelEquipoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelEquipoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAtras1)
                    .addComponent(btnSiguienteAEvidencia)
                    .addComponent(jButton4)
                    .addComponent(jButton5))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.add(jPanelEquipo, "card2");

        jPanel12.setBackground(new java.awt.Color(255, 255, 255));
        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Pasos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel12.setPreferredSize(new java.awt.Dimension(170, 441));

        jLabel9.setText("1. Crear caso");

        jLabel25.setText("2. Equipo de investigación");

        jLabel26.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel26.setText("3. Evidencia");

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addComponent(jLabel25)
                    .addComponent(jLabel26))
                .addGap(0, 33, Short.MAX_VALUE))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel25)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel26)
                .addContainerGap(353, Short.MAX_VALUE))
        );

        btnAtras3.setText("Atrás");
        btnAtras3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtras3ActionPerformed(evt);
            }
        });

        btnSiguiente3.setText("Siguiente");
        btnSiguiente3.setEnabled(false);
        btnSiguiente3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSiguiente3ActionPerformed(evt);
            }
        });

        jButton7.setText("Cancelar");
        jButton7.setEnabled(false);

        btnFinalizar.setText("Finalizar");
        btnFinalizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFinalizarActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Evidencia", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel2.setPreferredSize(new java.awt.Dimension(575, 441));

        jLabel5.setText("Fecha de incautación:");

        jLabel6.setText("Lugar de incautación:");

        jLabel7.setText("Dispositivos:");

        btnAñadirDispositivos.setText("Añadir");
        btnAñadirDispositivos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAñadirDispositivosActionPerformed(evt);
            }
        });

        jLabel10.setText("Hora de incautación:");

        jLabel33.setText("Observaciones:");

        txtObservaciones.setColumns(20);
        txtObservaciones.setLineWrap(true);
        txtObservaciones.setRows(5);
        txtObservaciones.setWrapStyleWord(true);
        txtObservaciones.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtObservacionesKeyTyped(evt);
            }
        });
        jScrollPane7.setViewportView(txtObservaciones);

        txtFechaIncautacion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtFechaIncautacionMouseClicked(evt);
            }
        });

        jLabel27.setText(":");

        cmbHora.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "HH", "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));

        cmbMinutos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "mm", "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", " " }));

        jLabel4.setText("Código evidencia:");

        txtCodigoEvidencia.setEditable(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel33)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtLugarIncautacion)
                            .addComponent(jScrollPane7)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(txtCodigoEvidencia, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtFechaIncautacion, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE))
                                .addGap(10, 10, 10)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cmbHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel27)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cmbMinutos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 81, Short.MAX_VALUE))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(65, 65, 65)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnAñadirDispositivos)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtCodigoEvidencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(jLabel10)
                        .addComponent(jLabel27)
                        .addComponent(cmbHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(cmbMinutos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(txtFechaIncautacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(txtLugarIncautacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel33)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAñadirDispositivos)
                    .addComponent(jLabel7))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanelEvidenciaLayout = new javax.swing.GroupLayout(jPanelEvidencia);
        jPanelEvidencia.setLayout(jPanelEvidenciaLayout);
        jPanelEvidenciaLayout.setHorizontalGroup(
            jPanelEvidenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelEvidenciaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelEvidenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelEvidenciaLayout.createSequentialGroup()
                        .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelEvidenciaLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnAtras3, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSiguiente3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnFinalizar)))
                .addContainerGap())
        );
        jPanelEvidenciaLayout.setVerticalGroup(
            jPanelEvidenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelEvidenciaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelEvidenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelEvidenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAtras3)
                    .addComponent(btnSiguiente3)
                    .addComponent(jButton7)
                    .addComponent(btnFinalizar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.add(jPanelEvidencia, "card2");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jLabelDescripcionRolMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDescripcionRolMouseClicked
        jDialog1.setVisible(true);
        //[460, 402]
        jDialog1.setSize(435, 440);
        jDialog1.setLocationRelativeTo(null);
    }//GEN-LAST:event_jLabelDescripcionRolMouseClicked

    private void btnAtras1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtras1ActionPerformed
        // TODO add your handling code here:
        //remover panel
        jPanel1.removeAll();
        jPanel1.repaint();
        jPanel1.revalidate();
        //añadir panel
        jPanel1.add(jPanelCreateCaso);
        jPanel1.repaint();
        jPanel1.revalidate();
    }//GEN-LAST:event_btnAtras1ActionPerformed

    private void btnSiguienteAEvidenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSiguienteAEvidenciaActionPerformed
        codEvidencia = "EVID_CASO-" + txtCodigoCaso.getText();
        txtCodigoEvidencia.setText(codEvidencia);

        //validar formulario
        if (jTablePersonal.getRowCount() > 0) {
            //remover panel
            jPanel1.removeAll();
            jPanel1.repaint();
            jPanel1.revalidate();
            //añadir panel
            jPanel1.add(jPanelEvidencia);
            jPanel1.repaint();
            jPanel1.revalidate();
        } else {
            JOptionPane.showMessageDialog(null, "Debe ingresar los responsables de la investigación");
        }

    }//GEN-LAST:event_btnSiguienteAEvidenciaActionPerformed

    private void btnAtras2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtras2ActionPerformed
        // TODO add your handling code here:
        //remover panel
        jPanel1.removeAll();
        jPanel1.repaint();
        jPanel1.revalidate();
        //añadir panel
        jPanel1.add(jPanelCreateCaso);
        jPanel1.repaint();
        jPanel1.revalidate();
    }//GEN-LAST:event_btnAtras2ActionPerformed

    private void btnSiguienteAEquipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSiguienteAEquipoActionPerformed
        // TODO add your handling code here:     
        //validar formulario
        Object[] datos = {txtCodigoCaso.getText(), txtSolicitante.getText(), txtDescripcion.getText(), txtObjetivos.getText(), txtAlcance.getText()};
        for (int i = 0; i <= datos.length - 1; i++) {
            String s = datos[i].toString();
            //||txtCodigoCaso.getText().isEmpty()
            if (s.isEmpty() || jDateChooserFechaSolicitud.getDate() == null) {
                JOptionPane.showMessageDialog(null, "Formulario incompleto");
                break;
            } else {
                //remover panel
                jPanel1.removeAll();
                jPanel1.repaint();
                jPanel1.revalidate();
                //añadir panel
                jPanel1.add(jPanelEquipo);
                jPanel1.repaint();
                jPanel1.revalidate();
            }

        }
    }//GEN-LAST:event_btnSiguienteAEquipoActionPerformed

    private void btnAtras3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtras3ActionPerformed
        // TODO add your handling code here:
        // TODO add your handling code here:
        //remover panel
        jPanel1.removeAll();
        jPanel1.repaint();
        jPanel1.revalidate();
        //añadir panel
        jPanel1.add(jPanelEquipo);
        jPanel1.repaint();
        jPanel1.revalidate();
    }//GEN-LAST:event_btnAtras3ActionPerformed

    private void btnSiguiente3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSiguiente3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnSiguiente3ActionPerformed

    private void btnAñadirDispositivosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAñadirDispositivosActionPerformed
       
        //verificar fechas
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        Date incau = txtFechaIncautacion.getDate();
        Date soli = jDateChooserFechaSolicitud.getDate();
        if (soli.before(incau)) {
            IngresarDispositivo dis = new IngresarDispositivo();
            dis.setVisible(true);
        } else {
            JOptionPane.showMessageDialog(null, "La fecha de incautación " + sdf.format(incau) + " debe ser mayor o igual a la fecha de solicitud " + sdf.format(soli));
        }
               

        
    }//GEN-LAST:event_btnAñadirDispositivosActionPerformed

    private void btnAñadirPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAñadirPersonaActionPerformed

        if (txtCedula.getText().isEmpty() || txtNombres.getText().isEmpty() || txtApellidos.getText().isEmpty() || cmbRol.getSelectedItem().equals("Seleccione")) {
            JOptionPane.showMessageDialog(null, "Falta llenar formulario");

        } else {
            //añadir datos tabla
            DefaultTableModel modelo = (DefaultTableModel) jTablePersonal.getModel();
            Object[] datos = new Object[4];
            datos[0] = txtCedula.getText();
            txtCedula.setText("");
            datos[1] = cmbRol.getSelectedItem().toString();

            cmbRol.setSelectedIndex(0);
            datos[2] = txtNombres.getText();
            txtNombres.setText("");
            datos[3] = txtApellidos.getText();
            txtApellidos.setText("");
            modelo.addRow(datos);
            jTablePersonal.setModel(modelo);
            //vaciar 
            //vaciarDatosEquipo();
        }
    }//GEN-LAST:event_btnAñadirPersonaActionPerformed

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        DefaultTableModel modelo = (DefaultTableModel) jTablePersonal.getModel();
        int a = jTablePersonal.getSelectedRow();
        if (a < 0) {
            JOptionPane.showMessageDialog(null, "Debe seleccionar una fila de la tabla");
        } else {
            int confirmar = JOptionPane.showConfirmDialog(null, "¿Esta seguro de eliminar el registro?");
            if (JOptionPane.OK_OPTION == confirmar) {
                modelo.removeRow(a);
                JOptionPane.showMessageDialog(null, "Registro eliminado");
            }
        }
    }//GEN-LAST:event_btnEliminarActionPerformed

    private void btnFinalizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarActionPerformed
        try {
            if (cmbHora.getSelectedItem().equals("HH")
                    || cmbMinutos.getSelectedItem().equals("mm")
                    //|| txtCodigoEvidencia.getText().isEmpty()
                    || txtLugarIncautacion.getText().isEmpty()
                    || txtObservaciones.getText().isEmpty()
                    || txtFechaIncautacion.getDate() == null) {
                JOptionPane.showMessageDialog(null, "Falta llenar formulario");
            } else {
                //guardar datos
                enviarAGuardarCaso();
                
            }
        } catch (ParseException ex) {
            Logger.getLogger(CrearCaso.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_btnFinalizarActionPerformed

    private void jTablePersonalMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTablePersonalMouseClicked
        //cargar datos tabla a formulario
        if (jTablePersonal.getRowCount() != 0) {
            String ident = jTablePersonal.getValueAt(jTablePersonal.getSelectedRow(), 0).toString();
            String rol = jTablePersonal.getValueAt(jTablePersonal.getSelectedRow(), 1).toString();
            String nombres = jTablePersonal.getValueAt(jTablePersonal.getSelectedRow(), 2).toString();
            String apellidos = jTablePersonal.getValueAt(jTablePersonal.getSelectedRow(), 3).toString();

            txtCedula.setText(ident);
            cmbRol.setSelectedItem(rol);
            txtNombres.setText(nombres);
            txtApellidos.setText(apellidos);

        } else {
            JOptionPane.showMessageDialog(null, "No se ha ingresado datos");
        }
    }//GEN-LAST:event_jTablePersonalMouseClicked

    private void btnCancelarCrearCasoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarCrearCasoActionPerformed
        dispose();
    }//GEN-LAST:event_btnCancelarCrearCasoActionPerformed

    private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed
        DefaultTableModel modelo = (DefaultTableModel) jTablePersonal.getModel();
        int a = jTablePersonal.getSelectedRow();
        if (a < 0) {
            JOptionPane.showMessageDialog(null, "Debe seleccionar una fila de la tabla");
        } else {
            Object[] datos = new Object[4];
            datos[0] = txtCedula.getText();
            txtCedula.setText("");
            datos[1] = cmbRol.getSelectedItem().toString();
            cmbRol.setSelectedIndex(0);
            datos[2] = txtNombres.getText();
            txtNombres.setText("");
            datos[3] = txtApellidos.getText();
            txtApellidos.setText("");
            //modelo.addRow(datos);
            for (int i = 0; i < jTablePersonal.getColumnCount(); i++) {
                modelo.setValueAt(datos[i], a, i);
            }
            JOptionPane.showMessageDialog(null, "Registro modificado");
        }
    }//GEN-LAST:event_btnModificarActionPerformed

    private void txtObservacionesKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtObservacionesKeyTyped
        String texto = txtObservaciones.getText();
        if (texto.length() > 0) {
            char[] caracteres = texto.toCharArray();
            caracteres[0] = Character.toUpperCase(caracteres[0]);
            txtObservaciones.setText(new String(caracteres));
            for (int i = 0; i < texto.length() - 2; i++) {
                if (caracteres[i] == '.' || caracteres[i] == '*' || caracteres[i] == '\n' || caracteres[i] == '-') {
                    caracteres[i + 1] = Character.toUpperCase(caracteres[i + 1]);
                    txtObservaciones.setText(new String(caracteres));
                }
            }
        }
    }//GEN-LAST:event_txtObservacionesKeyTyped

    private void txtDescripcionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtDescripcionKeyTyped
        String texto = txtDescripcion.getText();
        if (texto.length() > 0) {
            char[] caracteres = texto.toCharArray();
            caracteres[0] = Character.toUpperCase(caracteres[0]);
            txtDescripcion.setText(new String(caracteres));
            for (int i = 0; i < texto.length() - 2; i++) {
                if (caracteres[i] == '.' || caracteres[i] == '*' || caracteres[i] == '\n' || caracteres[i] == '-') {
                    caracteres[i + 1] = Character.toUpperCase(caracteres[i + 1]);
                    txtDescripcion.setText(new String(caracteres));
                }
            }
        }
    }//GEN-LAST:event_txtDescripcionKeyTyped

    private void txtObjetivosKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtObjetivosKeyTyped
        String texto = txtObjetivos.getText();
        if (texto.length() > 0) {
            char[] caracteres = texto.toCharArray();
            caracteres[0] = Character.toUpperCase(caracteres[0]);
            txtObjetivos.setText(new String(caracteres));
            for (int i = 0; i < texto.length() - 2; i++) {
                if (caracteres[i] == '.' || caracteres[i] == '*' || caracteres[i] == '\n' || caracteres[i] == '-') {
                    caracteres[i + 1] = Character.toUpperCase(caracteres[i + 1]);
                    txtObjetivos.setText(new String(caracteres));
                }
            }
        }
    }//GEN-LAST:event_txtObjetivosKeyTyped

    private void txtAlcanceKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAlcanceKeyTyped
        String texto = txtAlcance.getText();
        if (texto.length() > 0) {
            char[] caracteres = texto.toCharArray();
            caracteres[0] = Character.toUpperCase(caracteres[0]);
            txtAlcance.setText(new String(caracteres));
            for (int i = 0; i < texto.length() - 2; i++) {
                if (caracteres[i] == '.' || caracteres[i] == '*' || caracteres[i] == '\n' || caracteres[i] == '-') {
                    caracteres[i + 1] = Character.toUpperCase(caracteres[i + 1]);
                    txtAlcance.setText(new String(caracteres));
                }
            }
        }
    }//GEN-LAST:event_txtAlcanceKeyTyped

    private void txtCodigoCasoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodigoCasoKeyTyped
        String cadena = txtCodigoCaso.getText().trim();
        if (cadena.length() > 0) {
            txtCodigoCaso.setText(cadena.toUpperCase().trim());
        }
    }//GEN-LAST:event_txtCodigoCasoKeyTyped

    private void txtFechaIncautacionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtFechaIncautacionMouseClicked
//verificar fechas
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        Date incau = txtFechaIncautacion.getDate();
        Date soli = jDateChooserFechaSolicitud.getDate();
        if (soli.before(incau)) {
//            IngresarDispositivo dis = new IngresarDispositivo();
//            dis.setVisible(true);
            System.out.println("correcto");
        } else {
            JOptionPane.showMessageDialog(null, "La fecha de incautación " + sdf.format(incau) + " debe ser mayor o igual a la fecha de solicitud " + sdf.format(soli));
        }
    }//GEN-LAST:event_txtFechaIncautacionMouseClicked

    public void SoloNumeros(JTextField a) {
        a.addKeyListener(new KeyAdapter() {
            @Override
            public void keyTyped(KeyEvent e) {
                char c = e.getKeyChar();
                //if (Character.isDigit(c)) {//para q solo ingrese letras
                if (Character.isLetter(c)) { //para q solo ingrese numeros
                    getToolkit().beep();
                    e.consume();
                    JOptionPane.showMessageDialog(null, "Ingrese sólo números");
                }
            }
        });
    }

    public void todoMayus(JTextField c) {
        c.addKeyListener(new KeyAdapter() {
            public void keyTyped(KeyEvent e) {
                String cadena = c.getText();
                if (cadena.length() > 0) {
                    c.setText(cadena.toUpperCase());
                }
            }
        });

    }

    public void primeraLetraMayuscula(JTextField p) {
        p.addKeyListener(new KeyAdapter() {
            public void keyTyped(KeyEvent e) {
                String cadena = p.getText();
                if (cadena.length() > 0) {
//                    String reemplaza = cadena.substring(0, 1).toUpperCase() + cadena.substring(1, cadena.length());
//                    p.setText(reemplaza);
                    char[] caracteres = cadena.toCharArray();
                    caracteres[0] = Character.toUpperCase(caracteres[0]);
                    p.setText(new String(caracteres));
                    for (int i = 0; i < cadena.length() - 2; i++) {
                        //if (caracteres[i] == ' ' || caracteres[i] == '.' || caracteres[i] == ',') {
                        if (caracteres[i] == ' ' || caracteres[i] == '.') {
                            caracteres[i + 1] = Character.toUpperCase(caracteres[i + 1]);

                            p.setText(new String(caracteres));
                        }

                    }

                }

            }
        });
    }

    public void Limite(JTextField l) {
        l.addKeyListener(new KeyListener() {

            @Override
            public void keyTyped(KeyEvent e) {
                if (l.getText().length() == 2) {
                    getToolkit().beep();
                    e.consume();
                }
            }

            @Override
            public void keyPressed(KeyEvent e) {
            }

            @Override
            public void keyReleased(KeyEvent e) {
            }
        });
    }

    public void vaciarDatosEquipo() {
        txtCedula.setText("");
        txtNombres.setText("");
        txtApellidos.setText("");
        cmbRol.setSelectedIndex(0);
    }

   

    public void enviarAGuardarCaso() throws ParseException {
        ConexionBD con = new ConexionBD();
        String codC = txtCodigoCaso.getText();
//        //Datos caso
        ////****fecha solicitud
        String formato = jDateChooserFechaSolicitud.getDateFormatString();
        Date fechaS = jDateChooserFechaSolicitud.getDate();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String fechasolicitud = sdf.format(fechaS);
        Date convertir = sdf.parse(fechasolicitud);
        long solicitud = convertir.getTime();
        ////****
        String personasolicita = txtSolicitante.getText();
        String des = txtDescripcion.getText();
        String obj = txtObjetivos.getText();
        String alcance = txtAlcance.getText();
        Case caso = new Case(codC, solicitud, personasolicita, des, obj, alcance);

        //datos evidencia
        String hora = cmbHora.getSelectedItem().toString().concat("-");
        String minuto = cmbMinutos.getSelectedItem().toString();
        Date fechaI = txtFechaIncautacion.getDate();
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        String fechaIn = sf.format(fechaI);

        System.out.println(fechaIn);
        String time = fechaIn.concat(" ").concat(hora).concat(minuto);
        System.out.println("--" + time);
        //despues convertir a GMT-5 fecha real
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH-mm");
        Date dt = f.parse(time);
        long fechaIncautacion = dt.getTime();
        System.out.println(time + "-->" + fechaIncautacion);
        //---
        String lugar = txtLugarIncautacion.getText();
        String observaciones = txtObservaciones.getText();
        String codEvid = txtCodigoEvidencia.getText();

        Evidence evidencia = new Evidence(codC,codEvid, fechaIncautacion, lugar, observaciones);

        //
        SimpleDateFormat forma = new SimpleDateFormat("dd-MM-yyyy");
        if (fechaS.before(fechaI)) {
            //*********************
            if (con.guardarCaso(caso)) {
                ////        *********************        
                int col = jTablePersonal.getColumnCount();
                int fila = jTablePersonal.getRowCount();
                Team personal;
                String ident;
                String rol;
                String nombres;
                String apellidos;
                for (int i = 0; i < fila; i++) {
                    ident = jTablePersonal.getValueAt(i, 0).toString();
                    rol = jTablePersonal.getValueAt(i, 1).toString();
                    nombres = jTablePersonal.getValueAt(i, 2).toString();
                    apellidos = jTablePersonal.getValueAt(i, 3).toString();
                    personal = new Team(ident, nombres, apellidos, rol);
                    if (con.guardarPersonal(codC, personal)) {
                        // JOptionPane.showMessageDialog(null, "Equipo de investigación registrado");                            
                    } else {
                        JOptionPane.showMessageDialog(null, "Error al guardar el Equipo de investigación");
                    }
                    if (con.guardarEvidencia(codC, evidencia)) {

                    } else {
                        JOptionPane.showMessageDialog(null, "Error al guardar la evidencia");
                    }
                    JOptionPane.showMessageDialog(null, "Datos guardados con exito");
                    dispose();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Error al guardar el caso");
            }
            //        //*************fin guardar caso

        } else {
            JOptionPane.showMessageDialog(null, "La fecha de incautación " + forma.format(fechaI) + " debe ser mayor o igual a la fecha de solicitud " + forma.format(fechaS));

        }

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;

                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CrearCaso.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
            log.error(ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CrearCaso.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
            log.error(ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CrearCaso.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
            log.error(ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CrearCaso.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
            log.error(ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CrearCaso().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAtras1;
    private javax.swing.JButton btnAtras2;
    private javax.swing.JButton btnAtras3;
    private javax.swing.JButton btnAñadirDispositivos;
    private javax.swing.JButton btnAñadirPersona;
    private javax.swing.JButton btnCancelarCrearCaso;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnFinalizar;
    private javax.swing.JButton btnModificar;
    private javax.swing.JButton btnSiguiente3;
    private javax.swing.JButton btnSiguienteAEquipo;
    private javax.swing.JButton btnSiguienteAEvidencia;
    private javax.swing.JComboBox cmbHora;
    private javax.swing.JComboBox cmbMinutos;
    private javax.swing.JComboBox cmbRol;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton7;
    private com.toedter.calendar.JDateChooser jDateChooserFechaSolicitud;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel33;
    public static javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelDescripcionRol;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanelCreateCaso;
    private javax.swing.JPanel jPanelEquipo;
    private javax.swing.JPanel jPanelEvidencia;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTable jTablePersonal;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextArea jTextArea3;
    private javax.swing.JTextArea txtAlcance;
    private javax.swing.JTextField txtApellidos;
    private javax.swing.JTextField txtCedula;
    public static javax.swing.JTextField txtCodigoCaso;
    public static javax.swing.JTextField txtCodigoEvidencia;
    private javax.swing.JTextArea txtDescripcion;
    public static com.toedter.calendar.JDateChooser txtFechaIncautacion;
    private javax.swing.JTextField txtLugarIncautacion;
    private javax.swing.JTextField txtNombres;
    private javax.swing.JTextArea txtObjetivos;
    private javax.swing.JTextArea txtObservaciones;
    private javax.swing.JTextField txtSolicitante;
    // End of variables declaration//GEN-END:variables
}
